var resetPwdSuccessSubmitCallback = function (data) {
    // tooltipWrong($('#requestSubmit'), '密码重置成功\uFF0C正在跳转...', 2);
    timeoutForward('/dealer.html', 1500);
};
$(function () {
    $('#main-form-container').inputValidate({
        submit: {
            query: '#requestSubmit'
        },
        inputs: [{
            query: '#requestMobile',
            regexp: window.commonRegexp.mobile,
            message: lang('tip.mobile'),
            emptyMessage: lang('tip.mobileNull')
        }, {
            query: '#requestPassword',
            regexp: window.commonRegexp.password,
            message: lang('tip.newpasswordwrong'),
            emptyMessage: lang('tip.newpasswordwrongNull')
        }, {
            query: '#requestConfirmPassword',
            regexp: window.commonRegexp.password,
            message: lang('tip.newPassword'),
            emptyMessage: lang('tip.newPasswordNull')
        }]
    });
    // 提交修改密码
    $('#requestSubmit').on('successSubmit.amos.inputValidate', function (e) {
        e.preventDefault();
        var submitBtn = $(this);
        if (submitBtn.attr('disabled') !== undefined) {
            return false;
        }
        //检查密码是否正确
        if ($('#requestPassword').val().trim() != $('#requestConfirmPassword').val().trim()) {
            formInlineTip($('#requestConfirmPassword'), lang('tip.affirmPassword'));
            return false;
        }
        submitBtn.attr('disabled', true);
        var params = {};
        params.mobile = $('#requestMobile').val();
        params.password = $('#requestPassword').val().trim();
        params.areaCode = $('.areaCodeValue').text().trim();
        ajaxRequest('/Home/Dealer/resetPassword', params, 'post', resetPwdSuccessSubmitCallback, null, submitBtn);
    });
});
